package ass2;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Vector;

public abstract class Agent {
	protected Location Location;
	protected Environment Environment;
	protected Vector<Action> PossibleActions;
	abstract void move();
	
	public Agent(Location spawn, Environment env) {
		Location = spawn;
		Environment = env;
		//Adding the possible movement of the agent
		PossibleActions = new Vector<Action>();
		PossibleActions.add(new Action( 1,  0));
		PossibleActions.add(new Action( 0,  1));
		PossibleActions.add(new Action(-1,  0));
		PossibleActions.add(new Action( 0, -1));

	}

	
	Location getLocation() {
		return Location;
	}

	void setLocation(Location newloc) {
		Location = newloc;
	}

	void updateLocation(Action action) {
		
		Location.x = Tools.mod((Location.x + action.x), Environment.BoardSize);
		Location.y = Tools.mod((Location.y + action.y), Environment.BoardSize);
	}

	Vector<Action> getActions() {
		Vector<Action> v = (Vector<Action>) PossibleActions.clone();
		return v;
	}

	
}
